import * as http from '@/utils/request'
import { BasePageRequest } from '@/models/requests'

const COMMENT_BASE_URL = '/comment'

/** 分类相关请求 */
const CommentApi = {
  getLinkCommentList: (query: CommentDto) => {
    return http.getList<CommentVo>(`${COMMENT_BASE_URL}/linkCommentList`, {
      params: query,
    })
  },
  addComment: (data: Comment) => {
    return http.postForBase(`${COMMENT_BASE_URL}`, data)
  },
}

export default CommentApi

export interface CommentDto extends BasePageRequest {
  pageNum: 1
  pageSize: 10
  articleId?: number
}

/** 响应参数 */

export interface CommentVo {
  id?: number

  articleId?: number

  rootId?: number

  content?: string

  toCommentUserId?: number

  toCommentUserName?: string

  toCommentId?: number

  createBy?: number

  createTime?: any

  username?: string

  children?: CommentVo[]
}

export interface Comment {
  serialVersionUID?: number

  id?: number

  type?: string

  articleId?: number

  rootId?: number

  content?: string

  toCommentUserId?: number

  toCommentId?: number

  delFlag?: number

  createBy?: number

  createTime?: any

  updateBy?: number

  updateTime?: any
}
